package edu.sctu.liangyuxiang.day20150521;

/**
 * Created by user20 on 2015/5/21.
 */
public class TextMore {
    public Teacher[] teacher;

    public Student[] student;

    public TextMore(Teacher[] teacher) {
        this.teacher = teacher;
    }


    public void sotrNumber(){
        Teacher teacher1 = new Teacher();
        for (int i = 0; i <teacher.length-1 ; i++) {
            for (int j = 0; j <teacher.length-1 ; j++) {
                if(teacher[j].number > teacher[j+1].number){
                    teacher1 = teacher[j];
                    teacher[j] = teacher[j+1];
                    teacher[j+1] = teacher1;
                }
            }
        }
    }

    public Student[] sortStudent(Student[] student){
        Student student1 = new Student();
        for (int i = 0; i < student.length-1 ; i++) {
            for (int j = 0; j < student.length-1 ; j++) {
                if(student[j].code < student[j+1].code){
                    student1 = student[j];
                    student[j] = student[j+1];
                    student[j+1] = student1;
                }
            }
        }
        return student;
    }

    public Teacher pritCoded(){
        Teacher returnTeacher = null;
        for (Teacher teacher : this.teacher) {
            if(teacher.title.equals("教授")){
                returnTeacher = teacher;
            }
        }
        return returnTeacher;
    }
}
